cli: Add shell completion generation command#1881
Conversation
There was a problem hiding this comment.
Code Review
This pull request adds a bootc completion command to generate shell completion scripts. The implementation is well-intentioned but manually generates the scripts, which is brittle and incomplete. I've provided feedback to use the clap_complete crate for a more robust and maintainable solution, which also aligns the implementation with the existing tests. I've also noted that clap_complete should be a regular dependency, not a dev-dependency, and pointed out some code duplication in the new tests.
4676f0f to
1c81141
Compare
|
Could you please sign off commit which is required by |
dd50060 to
0df21d6
Compare
|
Also, thanks so much for working on this!! |
0df21d6 to
b7a1551
Compare
c020978 to
0d7d745
Compare
|
I've made a few updates before pushing:
|
04df01c to
8594e46
Compare
Also we do have a spec file here...so it'd likely be useful to actually do that change in it. It looks like at least podman ships bash and fish completions by default. Also they ship a man page Also I tested this out, it seems to work well but one thing I noticed I don't like is that it shows our |
- Add completion subcommand supporting bash, zsh, and fish Assisted-by: Cursor (Auto) Signed-off-by: Shion Tanaka <shtanaka@redhat.com>
8594e46 to
0211fe2
Compare
Summary
Add a hidden
bootc completion <shell>subcommand that generates shell completion scripts for bash, zsh, and fish.Motivation
This enables distributions (e.g., Fedora, CentOS Stream, RHEL) to generate and package shell completions during RPM/deb builds by calling:
Implementation Details
CompletionShellenum with Bash, Zsh, and Fish variantsclap::CommandFactoryto introspect the CLI structureclap_completeas a dev-dependencyTesting